package com.a918.service.impl;

import com.a918.dao.ContentCheckMapper;
import com.a918.dao.ContentMapper;
import com.a918.dao.UserMapper;
import com.a918.entity.Content;
import com.a918.entity.ContentCheck;
import com.a918.service.ContentCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ContentCheckServiceImp implements ContentCheckService {

    private ContentCheckMapper contentCheckMapper;
    private ContentMapper contentMapper;

    @Autowired
    public ContentCheckServiceImp(ContentCheckMapper contentCheckMapper
            , ContentMapper contentMapper) {
        this.contentCheckMapper = contentCheckMapper;
        this.contentMapper = contentMapper;
    }

    @Override
    public void setback(ContentCheck record) {
        Content data = new Content();
        contentCheckMapper.insert(record);
        data.setId(record.getContentid());
        data.setStatus("dxg");
        contentMapper.updateByPrimaryKeySelective(data);
    }

    @Override
    public void deleteByContentId(Integer contentId){
        contentCheckMapper.deleteByContentId(contentId);
    }

    @Override
    public ContentCheck selectByContentId(Integer contentID){
        return contentCheckMapper.selectByContentId(contentID);
    }
}
